package org.springblade.pm.service;

import org.springblade.core.mp.base.BaseService;
import org.springblade.pm.entity.File;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

public interface IFileService extends BaseService<File> {

	/**
	 * 批量保存文件
	 *
	 * @param files
	 * @param file
	 * @return
	 */
	@Transactional(
		rollbackFor = {Exception.class}
	)
	boolean saveBatch(MultipartFile[] files, File file);

	/**
	 * 批量删除文件
	 *
	 * @param ids
	 * @return
	 */
	@Transactional(
		rollbackFor = {Exception.class}
	)
	boolean removeBatchByIds(String ids);

	/**
	 * 下载文件
	 *
	 * @param response
	 * @param id
	 * @return
	 */
	void downloadFile(HttpServletResponse response, String id);

	/**
	 * 文件预览
	 *
	 * @param response
	 * @param id
	 */
	void preView(HttpServletResponse response, String id);

	/**
	 * 批量下载
	 *
	 * @param response
	 * @param ids
	 */
	void downloadBatch(HttpServletResponse response, String ids, String zipName);
}
